/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity_bean;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Mamoune
 */
@Entity
@Table(name = "experience")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Experience.findAll", query = "SELECT e FROM Experience e"),
    @NamedQuery(name = "Experience.findByPERSONNEid", query = "SELECT e FROM Experience e WHERE e.experiencePK.pERSONNEid = :pERSONNEid"),
    @NamedQuery(name = "Experience.findByCOMPETENCEid", query = "SELECT e FROM Experience e WHERE e.experiencePK.cOMPETENCEid = :cOMPETENCEid"),
    @NamedQuery(name = "Experience.findByAnneeDebut", query = "SELECT e FROM Experience e WHERE e.anneeDebut = :anneeDebut")})
public class Experience implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ExperiencePK experiencePK;
    @Column(name = "annee_debut")
    @Temporal(TemporalType.DATE)
    private Date anneeDebut;

    public Experience() {
    }

    public Experience(ExperiencePK experiencePK) {
        this.experiencePK = experiencePK;
    }

    public Experience(int pERSONNEid, int cOMPETENCEid) {
        this.experiencePK = new ExperiencePK(pERSONNEid, cOMPETENCEid);
    }

    public ExperiencePK getExperiencePK() {
        return experiencePK;
    }

    public void setExperiencePK(ExperiencePK experiencePK) {
        this.experiencePK = experiencePK;
    }

    public Date getAnneeDebut() {
        return anneeDebut;
    }

    public void setAnneeDebut(Date anneeDebut) {
        this.anneeDebut = anneeDebut;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (experiencePK != null ? experiencePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Experience)) {
            return false;
        }
        Experience other = (Experience) object;
        if ((this.experiencePK == null && other.experiencePK != null) || (this.experiencePK != null && !this.experiencePK.equals(other.experiencePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity_bean.Experience[ experiencePK=" + experiencePK + " ]";
    }
    
}
